﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Lyh.Dbdg.Model;
using Lyh.MyBatis.DAL.Implements;
using Lyh.Dbdg.DataAccess;

namespace Lyh.Dbdg.Business
{
    public class DatabaseManager
    {
        public static Database GetCurrentDatabase()
        {
            var dao = new DatabaseDao();
            return dao.Get(null);
        }

        public static IList<Table> GetTables()
        {
            var dao = new TableDao();
            return dao.GetList(null);
        }

        public static IList<Column> GetColumns(string tableName)
        {
            var dao = new ColumnDao();
            return dao.GetList(tableName);
        }

        public static void RefreshConfig(Category cat)
        {
            Mapper.Category = cat;
            Mapper.Rebuild();
        }
    }
}
